﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace CSCV.Group8.BlogRollWebPart.Presenter
{
    /// <summary>
    /// The Presenter
    /// </summary>
    public class BRPresenter
    {
        #region field
        Interface.IBRView _view; //View
        Interface.IBRModel _model; //Model
        #endregion

        #region ctor
        /// <summary>
        /// ctor
        /// </summary>
        /// <param name="view">View</param>
        /// <param name="model">Model</param>
        public BRPresenter(Interface.IBRView view, Interface.IBRModel model)
        {
            _view = view;
            _model = model;
        }
        #endregion

        #region method
        /// <summary>
        /// Init View as the first state
        /// </summary>
        public void InitView()
        {
            this._view.ListPost = this._model.Init();
        }

        /// <summary>
        /// Add comment to the specific post
        /// </summary>
        /// <param name="commentTitle">Title of the comment</param>
        /// <param name="commentContent">Body of the comment</param>
        /// <param name="postID">The Post ID to be comment</param>
        /// <param name="strspweburl">The Url of the Web</param>
        public void AddComment(string commentTitle, string commentContent, int postID, string strspweburl)
        {
            this._model.AddComment(commentContent, commentTitle, postID, strspweburl);
            InitView();
        }
        #endregion
    }
}
